import { CATEGORY_MENU, PROD_PAGEPROD } from '../constants/category'

const INITIAL_STATE = {
    categoryList: [],
    prodList: ''
}

export default function category(state = INITIAL_STATE, action) {
    switch (action.type) {
        case CATEGORY_MENU: {
            return {
                ...state,
                categoryList: action.payload,
                categoryImg: action.payload[0].pic
            }
        }
        case PROD_PAGEPROD: {
            return {
                ...state,
                prodList: action.payload
            }
        }
        default: {
            return state
        }
    }
}